//
//  LFMineYouHuiQuanController.m
//  LoveFruit
//
//  Created by Apple on 16/9/26.
//  Copyright © 2016年 张令林. All rights reserved.
//

#import "LFMineYouHuiQuanController.h"
#import "LFMineYouViewCell.h"
@interface LFMineYouHuiQuanController ()<UITableViewDelegate,UITableViewDataSource>
@property (weak, nonatomic) IBOutlet UIView *headeerView;
@property (weak, nonatomic) IBOutlet UITableView *tableview;
@property(nonatomic,strong)NSArray *arr;
@property (weak, nonatomic) IBOutlet UITextField *textFile;

@end

@implementation LFMineYouHuiQuanController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.navigationItem.title = @"优惠券";
    UIButton *but = [[UIButton alloc] init];
    [but setImage:[UIImage imageNamed:@"btn_backItem"] forState:UIControlStateNormal];
    [but addTarget:self action:@selector(pop) forControlEvents:UIControlEventTouchUpInside];
    UIBarButtonItem *bar = [[UIBarButtonItem alloc] initWithCustomView:but];
    self.navigationItem.leftBarButtonItem = bar;
    self.tableview.estimatedRowHeight = UITableViewAutomaticDimension;
    self.tableview.rowHeight = 100;
    [self.tableview registerNib:[UINib nibWithNibName:@"LFMineYouViewCell" bundle:nil] forCellReuseIdentifier:@"cell"];
    self.arr = @[@"未使用的优惠券",@"使用的优惠券",@"使用的优惠券",@"使用的优惠券",@"使用的优惠券"];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return self.arr.count;
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    LFMineYouViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cell" forIndexPath:indexPath];
    cell.image.image = [UIImage imageNamed:self.arr[indexPath.row]];
    return cell;
}
-(void)pop{
    [self dismissViewControllerAnimated:YES completion:nil];
}
- (IBAction)doButton:(id)sender {
    if ([self.textFile.text isEqualToString:@""]) {
        
    }else{
    [SVProgressHUD showInfoWithStatus:@"没有符合的优惠券哟"];
    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
        [SVProgressHUD dismiss];
    });
    }
}

@end
